function [TotalPayoff numOfSell Buy Sell] = tradingStrategyVec1(rPortfolioTest, myVaRup, myVaRdown, V0)

    %% strategy 1: buy when rPortfolioTest(i) under myVaRdown, sell 4
    %  days after

    TotalPayoff = 0;
    rBuy = 0; 
    days = 0;
    numOfDays = 4;
    Buy = []; Sell = [];
    for i = 1:length(rPortfolioTest)
        if (rPortfolioTest(i,:) <= myVaRdown(i) && rBuy == 0)
            rBuy = rPortfolioTest(i, :);
            Buy = [Buy; 1];     Sell = [Sell; 0];
        elseif (days >= numOfDays - 1)
            TotalPayoff = TotalPayoff + V0 * (rPortfolioTest(i,:) - rBuy);
            days = 0;           rBuy = 0;
            Buy = [Buy; 0];     Sell = [Sell; 1];
        else
            if (rBuy ~= 0)
                days = days + 1;
            Buy = [Buy; 0];     Sell = [Sell; 0];
        end
    end
end